package com.example.myapplication.widgets.pickerview.base;

import java.util.Locale;

public class IntPickerBean implements PickerBean {

    public int value;
    // 控制显示位数
    public int digit = 0;

    public IntPickerBean(int value) {
        this.value = value;
    }

    public IntPickerBean(int value, int digit) {
        this.value = value;
        this.digit = digit;
    }

    @Override
    public String getText() {
        if (digit > 0)
            return String.format(Locale.getDefault(), String.format(Locale.getDefault(), "%%0%dd", digit), value);
        else
            return String.valueOf(value);
    }
}
